let path = Conf.img_fname

let load i =
  let surface = Cairo.PNG.create path in
  let w = Cairo.Image.get_width surface in
  let h = (Cairo.Image.get_height surface) / 78 in
  let destination = Cairo.Image.create (Cairo.Image.get_format surface)
    ~width:w ~height:h in                
  let ctx = Cairo.create destination in
  let () = Cairo.set_source_surface ctx surface ~x:0. ~y:(float_of_int (-(h * i))) in
  let () = Cairo.paint ctx in
  let chaine = ref [] in
  let () = Cairo.PNG.write_to_stream destination
    (fun str -> chaine := str :: (!chaine)) in
  String.concat "" (List.rev !chaine)
    
